<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   很全的 Python 面试题  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/24462.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466459837: Accept with keywords: (title(0.25):Python,面试题,数盟,社区, topn(0.366666666667):区别,队列,数盟,编译,内存,副作用,集合,变量,遍历,协程,Python,对象,参数,方法,函数,python,编程,问题,地址,实例,进程,链接,资源,功能,作用域,代码,程序,算法,线程,垃圾).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    很全的 Python 面试题
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    很全的 Python 面试题 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,61] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/devl">
       编程语言
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/24462.html">
          很全的 Python 面试题
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          687 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/devl" rel="category tag">
          编程语言
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        原文链接：
        <a href="https://github.com/taizilongxu/interview_python" target="_blank">
         taizilongxu 综合整理
        </a>
       </p>
       <h1>
        Python语言特性
       </h1>
       <h2>
        1 Python的函数参数传递
       </h2>
       <p>
        看两个例子:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd30474809333">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd30474809333-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd30474809333-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd30474809333-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd30474809333-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd30474809333-5">
               5
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd30474809333-1">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd30474809333-2">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                fun
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd30474809333-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                2
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd30474809333-4">
               <span class="crayon-e">
                fun
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd30474809333-5">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # 1
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd3d940590396">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd3d940590396-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd3d940590396-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd3d940590396-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd3d940590396-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd3d940590396-5">
               5
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd3d940590396-1">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd3d940590396-2">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                fun
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd3d940590396-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd3d940590396-4">
               <span class="crayon-e">
                fun
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd3d940590396-5">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # [1]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        所有的变量都可以理解是内存中一个对象的“引用”，或者，也可以看似c中void*的感觉。
       </p>
       <p>
        这里记住的是类型是属于对象的，而不是变量。而对象有两种,“可更改”（mutable）与“不可更改”（immutable）对象。在python中，strings, tuples, 和numbers是不可更改的对象，而list,dict等则是可以修改的对象。(这就是这个问题的重点)
       </p>
       <p>
        当一个引用传递给函数的时候,函数自动复制一份引用,这个函数里的引用和外边的引用没有半毛关系了.所以第一个例子里函数把引用指向了一个不可变对象,当函数返回的时候,外面的引用没半毛感觉.而第二个例子就不一样了,函数内的引用指向的是可变对象,对它的操作就和定位了指针地址一样,在内存里进行修改.
       </p>
       <p>
        如果还不明白的话,这里有更好的解释: http://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference
       </p>
       <h2>
        2 Python中的元类(metaclass)
       </h2>
       <p>
        这个非常的不常用,但是像ORM这种复杂的结构还是会需要的,详情请看：《
        <a href="http://python.jobbole.com/21351/" target="_blank">
         <span data-rel="title">
          深刻理解Python中的元类(metaclass)
         </span>
        </a>
        》
       </p>
       <h2>
        3 @staticmethod和@classmethod
       </h2>
       <p>
        Python其实有3个方法,即静态方法(staticmethod),类方法(classmethod)和实例方法,如下:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd44963037140">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd44963037140-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd44963037140-16">
               16
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd44963037140-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                “executing foo(%s)”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-3">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-4">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                A
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                “executing foo(%s,%s)”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                @
               </span>
               <span class="crayon-k ">
                classmethod
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                class_foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                “executing class_foo(%s,%s)”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-11">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                @
               </span>
               <span class="crayon-k ">
                staticmethod
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                static_foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                “executing static_foo(%s)”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-i">
                x
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd44963037140-15">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd44963037140-16">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                A
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        这里先理解下函数参数里面的self和cls.这个self和cls是对类或者实例的绑定,对于一般的函数来说我们可以这么调用
        <code>
         foo(x)
        </code>
        ,这个函数就是最常用的,它的工作跟任何东西(类,实例)无关.对于实例方法,我们知道在类里每次定义方法的时候都需要绑定这个实例,就是
        <code>
         foo(self, x)
        </code>
        ,为什么要这么做呢?因为实例方法的调用离不开实例,我们需要把实例自己传给函数,调用的时候是这样的
        <code>
         a.foo(x)
        </code>
        (其实是
        <code>
         foo(a, x)
        </code>
        ).类方法一样,只不过它传递的是类而不是实例,
        <code>
         A.class_foo(x)
        </code>
        .注意这里的self和cls可以替换别的参数,但是python的约定是这俩,还是不要改的好.
       </p>
       <p>
        对于静态方法其实和普通的方法一样,不需要对谁进行绑定,唯一的区别是调用的时候需要使用
        <code>
         a.static_foo(x)
        </code>
        或者
        <code>
         A.static_foo(x)
        </code>
        来调用.
       </p>
       <table>
        <thead>
         <tr>
          <th>
           \
          </th>
          <th>
           实例方法
          </th>
          <th>
           类方法
          </th>
          <th>
           静态方法
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           a = A()
          </td>
          <td>
           a.foo(x)
          </td>
          <td>
           a.class_foo(x)
          </td>
          <td>
           a.static_foo(x)
          </td>
         </tr>
         <tr>
          <td>
           A
          </td>
          <td>
           不可用
          </td>
          <td>
           A.class_foo(x)
          </td>
          <td>
           A.static_foo(x)
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        更多关于这个问题:http://stackoverflow.com/questions/136097/what-is-the-difference-between-staticmethod-and-classmethod-in-python
       </p>
       <h2>
        4 类变量和实例变量
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd49738509777">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd49738509777-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd49738509777-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd49738509777-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd49738509777-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd49738509777-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd49738509777-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd49738509777-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd49738509777-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd49738509777-9">
               9
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd49738509777-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                Person
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd49738509777-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                “aaa”
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd49738509777-3">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd49738509777-4">
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Person
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd49738509777-5">
               <span class="crayon-v">
                p2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Person
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd49738509777-6">
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                “bbb”
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd49738509777-7">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # bbb
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd49738509777-8">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                p2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # aaa
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd49738509777-9">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                Person
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # aaa
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        类变量就是供类使用的变量,实例变量就是供实例使用的.
       </p>
       <p>
        这里
        <code>
         p1.name="bbb"
        </code>
        是实例调用了类变量,这其实和上面第一个问题一样,就是函数传参的问题,
        <code>
         p1.name
        </code>
        一开始是指向的类变量
        <code>
         name="aaa"
        </code>
        ,但是在实例的作用域里把类变量的引用改变了,就变成了一个实例变量,self.name不再引用Person的类变量name了.
       </p>
       <p>
        可以看看下面的例子:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd4d264695691">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd4d264695691-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd4d264695691-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd4d264695691-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd4d264695691-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd4d264695691-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd4d264695691-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd4d264695691-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd4d264695691-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd4d264695691-9">
               9
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd4d264695691-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                Person
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd4d264695691-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd4d264695691-3">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd4d264695691-4">
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Person
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd4d264695691-5">
               <span class="crayon-v">
                p2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Person
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd4d264695691-6">
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd4d264695691-7">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                p1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # [1]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd4d264695691-8">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                p2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # [1]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd4d264695691-9">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                Person
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # [1]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        参考:http://stackoverflow.com/questions/6470428/catch-multiple-exceptions-in-one-line-except-block
       </p>
       <h2>
        5 Python自省
       </h2>
       <p>
        这个也是python彪悍的特性.
       </p>
       <p>
        自省就是面向对象的语言所写的程序在运行时,所能知道对象的类型.简单一句就是运行时能够获得对象的类型.比如type(),dir(),getattr(),hasattr(),isinstance().
       </p>
       <h2>
        6 字典推导式
       </h2>
       <p>
        可能你见过列表推导时,却没有见过字典推导式,在2.7中才加入的:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd51038332902">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd51038332902-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd51038332902-1">
               <span class="crayon-v">
                d
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                key
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-e">
                value
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                key
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                value
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                iterable
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        7 Python中单下划线和双下划线
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd55477617643">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd55477617643-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd55477617643-14">
               14
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd55477617643-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                MyClass
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-2">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __init__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-3">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                __superprivate
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                “Hello”
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-4">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                _semiprivate
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                “, world!”
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-5">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-6">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-v">
                mc
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                MyClass
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-7">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                mc
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                __superprivate
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-8">
               <span class="crayon-k ">
                Traceback
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                most
               </span>
               <span class="crayon-e">
                recent
               </span>
               <span class="crayon-e">
                call
               </span>
               <span class="crayon-v">
                last
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                File
               </span>
               <span class="crayon-s">
                “&lt;stdin&gt;”
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-i">
                line
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                module
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-10">
               <span class="crayon-k ">
                AttributeError
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-e">
                myClass
               </span>
               <span class="crayon-e">
                instance
               </span>
               <span class="crayon-e">
                has
               </span>
               <span class="crayon-e">
                no
               </span>
               <span class="crayon-i">
                attribute
               </span>
               <span class="crayon-s">
                ‘__superprivate’
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-11">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                mc
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-i">
                _semiprivate
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-12">
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                world
               </span>
               <span class="crayon-o">
                !
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd55477617643-13">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                mc
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                __dict_
               </span>
               <span class="crayon-sy">
                _
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd55477617643-14">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                ‘_MyClass__superprivate’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                ‘Hello’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘_semiprivate’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                ‘, world!’
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        <code>
         __foo__
        </code>
        :一种约定,Python内部的名字,用来区别其他用户自定义的命名,以防冲突.
       </p>
       <p>
        <code>
         _foo
        </code>
        :一种约定,用来指定变量私有.程序员用来指定私有变量的一种方式.
       </p>
       <p>
        <code>
         __foo
        </code>
        :这个有真正的意义:解析器用
        <code>
         _classname__foo
        </code>
        来代替这个名字,以区别和其他类相同的命名.
       </p>
       <p>
        详情见:http://stackoverflow.com/questions/1301346/the-meaning-of-a-single-and-a-double-underscore-before-an-object-name-in-python
       </p>
       <p>
        或者: http://www.zhihu.com/question/19754941
       </p>
       <h2>
        8 字符串格式化:%和.format
       </h2>
       <p>
        .format在许多方面看起来更便利.对于
        <code>
         %
        </code>
        最烦人的是它无法同时传递一个变量和元组.你可能会想下面的代码不会有什么问题:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd58631647177">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd58631647177-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd58631647177-1">
               <span class="crayon-s">
                “hi there %s”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-v">
                name
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        但是,如果name恰好是(1,2,3),它将会抛出一个TypeError异常.为了保证它总是正确的,你必须这样做:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd5c848008496">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd5c848008496-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd5c848008496-1">
               <span class="crayon-s">
                “hi there %s”
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # 提供一个单元素的数组而不是一个参数
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        但是有点丑..format就没有这些问题.你给的第二个问题也是这样,.format好看多了.
       </p>
       <p>
        你为什么不用它?
       </p>
       <ul>
        <li>
         不知道它(在读这个之前)
        </li>
        <li>
         为了和Python2.5兼容(譬如logging库建议使用
         <code>
          %
         </code>
         (
         <a href="https://github.com/taizilongxu/interview_python/issues/4">
          issue #4
         </a>
         ))
        </li>
       </ul>
       <p>
        http://stackoverflow.com/questions/5082452/python-string-formatting-vs-format
       </p>
       <h2>
        9 迭代器和生成器
       </h2>
       <p>
        这个是stackoverflow里python排名第一的问题,值得一看: http://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do-in-python
       </p>
       <p>
        这是中文版: http://taizilongxu.gitbooks.io/stackoverflow-about-python/content/1/README.html
       </p>
       <h2>
        10
        <code>
         *args
        </code>
        and
        <code>
         **kwargs
        </code>
       </h2>
       <p>
        用
        <code>
         *args
        </code>
        和
        <code>
         **kwargs
        </code>
        只是为了方便并没有强制使用它们.
       </p>
       <p>
        当你不确定你的函数里将要传递多少参数时你可以用
        <code>
         *args
        </code>
        .例如,它可以传递任意数量的参数:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd5f196685005">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd5f196685005-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd5f196685005-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd5f196685005-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd5f196685005-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd5f196685005-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd5f196685005-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd5f196685005-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd5f196685005-8">
               8
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd5f196685005-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                print_everything
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd5f196685005-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-v">
                count
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                thing
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                enumerate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd5f196685005-3">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘{0}. {1}’
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                format
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                count
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                thing
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd5f196685005-4">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd5f196685005-5">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-e">
                print_everything
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘apple’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘banana’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘cabbage’
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd5f196685005-6">
               <span class="crayon-cn">
                0.
               </span>
               <span class="crayon-i">
                apple
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd5f196685005-7">
               <span class="crayon-cn">
                1.
               </span>
               <span class="crayon-i">
                banana
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd5f196685005-8">
               <span class="crayon-cn">
                2.
               </span>
               <span class="crayon-v">
                cabbage
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        相似的,
        <code>
         **kwargs
        </code>
        允许你使用没有事先定义的参数名:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd63680427461">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd63680427461-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd63680427461-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd63680427461-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd63680427461-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd63680427461-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd63680427461-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd63680427461-7">
               7
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd63680427461-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                table_things
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kwargs
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd63680427461-2">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                value
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                kwargs
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                items
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd63680427461-3">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘{0} = {1}’
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                format
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                name
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                value
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd63680427461-4">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd63680427461-5">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-e">
                table_things
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                apple
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                ‘fruit’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                cabbage
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                ‘vegetable’
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd63680427461-6">
               <span class="crayon-v">
                cabbage
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                vegetable
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd63680427461-7">
               <span class="crayon-v">
                apple
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                fruit
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        你也可以混着用.命名参数首先获得参数值然后所有的其他参数都传递给
        <code>
         *args
        </code>
        和
        <code>
         **kwargs
        </code>
        .命名参数在列表的最前端.例如:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd66234386592">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd66234386592-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd66234386592-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                table_things
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                titlestring
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kwargs
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        <code>
         *args
        </code>
        和
        <code>
         **kwargs
        </code>
        可以同时在函数的定义中,但是
        <code>
         *args
        </code>
        必须在
        <code>
         **kwargs
        </code>
        前面.
       </p>
       <p>
        当调用函数时你也可以用
        <code>
         *
        </code>
        和
        <code>
         **
        </code>
        语法.例如:
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd74717689734">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd74717689734-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd74717689734-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd74717689734-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd74717689734-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd74717689734-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd74717689734-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd74717689734-7">
               7
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd74717689734-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                print_three_things
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                c
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd74717689734-2">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘a = {0}, b = {1}, c = {2}’
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                format
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                c
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd74717689734-3">
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd74717689734-4">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-v">
                mylist
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘aardvark’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘baboon’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘cat’
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd74717689734-5">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-e">
                print_three_things
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                mylist
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd74717689734-6">
              </div>
              <div class="crayon-line" id="crayon-575513db9dd74717689734-7">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                aardvark
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                baboon
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                c
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                cat
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        就像你看到的一样,它可以传递列表(或者元组)的每一项并把它们解包.注意必须与它们在函数里的参数相吻合.当然,你也可以在函数定义或者函数调用时用*.
       </p>
       <p>
        http://stackoverflow.com/questions/3394835/args-and-kwargs
       </p>
       <h2>
        11 面向切面编程AOP和装饰器
       </h2>
       <p>
        这个AOP一听起来有点懵,同学面阿里的时候就被问懵了…
       </p>
       <p>
        装饰器是一个很著名的设计模式，经常被用于有切面需求的场景，较为经典的有插入日志、性能测试、事务处理等。装饰器是解决这类问题的绝佳设计，有了装饰器，我们就可以抽离出大量函数中与函数功能本身无关的雷同代码并继续重用。概括的讲，
        <strong>
         装饰器的作用就是为已经存在的对象添加额外的功能。
        </strong>
       </p>
       <p>
        这个问题比较大,推荐: http://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python
       </p>
       <p>
        中文: http://taizilongxu.gitbooks.io/stackoverflow-about-python/content/3/README.html
       </p>
       <h2>
        12 鸭子类型
       </h2>
       <p>
        “当看到一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子，那么这只鸟就可以被称为鸭子。”
       </p>
       <p>
        我们并不关心对象是什么类型，到底是不是鸭子，只关心行为。
       </p>
       <p>
        比如在python中，有很多file-like的东西，比如StringIO,GzipFile,socket。它们有很多相同的方法，我们把它们当作文件使用。
       </p>
       <p>
        又比如list.extend()方法中,我们并不关心它的参数是不是list,只要它是可迭代的,所以它的参数可以是list/tuple/dict/字符串/生成器等.
       </p>
       <p>
        鸭子类型在动态语言中经常使用，非常灵活，使得python不想java那样专门去弄一大堆的设计模式。
       </p>
       <h2>
        13 Python中重载
       </h2>
       <p>
        引自知乎:http://www.zhihu.com/question/20053359
       </p>
       <p>
        函数重载主要是为了解决两个问题。
       </p>
       <ol>
        <li>
         可变参数类型。
        </li>
        <li>
         可变参数个数。
        </li>
       </ol>
       <p>
        另外，一个基本的设计原则是，仅仅当两个函数除了参数类型和参数个数不同以外，其功能是完全相同的，此时才使用函数重载，如果两个函数的功能其实不同，那么不应当使用重载，而应当使用一个名字不同的函数。
       </p>
       <p>
        好吧，那么对于情况 1 ，函数功能相同，但是参数类型不同，python 如何处理？答案是根本不需要处理，因为 python 可以接受任何类型的参数，如果函数的功能相同，那么不同的参数类型在 python 中很可能是相同的代码，没有必要做成两个不同函数。
       </p>
       <p>
        那么对于情况 2 ，函数功能相同，但参数个数不同，python 如何处理？大家知道，答案就是缺省参数。对那些缺少的参数设定为缺省参数即可解决问题。因为你假设函数功能相同，那么那些缺少的参数终归是需要用的。
       </p>
       <p>
        好了，鉴于情况 1 跟 情况 2 都有了解决方案，python 自然就不需要函数重载了。
       </p>
       <h2>
        14 新式类和旧式类
       </h2>
       <p>
        这个面试官问了,我说了老半天,不知道他问的真正意图是什么.
       </p>
       <p>
        <a href="http://stackoverflow.com/questions/54867/what-is-the-difference-between-old-style-and-new-style-classes-in-python">
         stackoverflow
        </a>
       </p>
       <p>
        这篇文章很好的介绍了新式类的特性: http://www.cnblogs.com/btchenguang/archive/2012/09/17/2689146.html
       </p>
       <p>
        新式类很早在2.2就出现了,所以旧式类完全是兼容的问题,Python3里的类全部都是新式类.这里有一个MRO问题可以了解下(新式类是广度优先,旧式类是深度优先),&lt;Python核心编程&gt;里讲的也很多.
       </p>
       <h2>
        15
        <code>
         __new__
        </code>
        和
        <code>
         __init__
        </code>
        的区别
       </h2>
       <p>
        这个
        <code>
         __new__
        </code>
        确实很少见到,先做了解吧.
       </p>
       <ol>
        <li>
         <code>
          __new__
         </code>
         是一个静态方法,而
         <code>
          __init__
         </code>
         是一个实例方法.
        </li>
        <li>
         <code>
          __new__
         </code>
         方法会返回一个创建的实例,而
         <code>
          __init__
         </code>
         什么都不返回.
        </li>
        <li>
         只有在
         <code>
          __new__
         </code>
         返回一个cls的实例时后面的
         <code>
          __init__
         </code>
         才能被调用.
        </li>
        <li>
         当创建一个新实例时调用
         <code>
          __new__
         </code>
         ,初始化一个实例时用
         <code>
          __init__
         </code>
         .
        </li>
       </ol>
       <p>
        <a href="http://stackoverflow.com/questions/674304/pythons-use-of-new-and-init">
         stackoverflow
        </a>
       </p>
       <p>
        ps:
        <code>
         __metaclass__
        </code>
        是创建类时起作用.所以我们可以分别使用
        <code>
         __metaclass__
        </code>
        ,
        <code>
         __new__
        </code>
        和
        <code>
         __init__
        </code>
        来分别在类创建,实例创建和实例初始化的时候做一些小手脚.
       </p>
       <h2>
        16 单例模式
       </h2>
       <p>
        这个绝对常考啊.绝对要记住1~2个方法,当时面试官是让手写的.
       </p>
       <h3>
        1 使用
        <code>
         __new__
        </code>
        方法
       </h3>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd7a738875785">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd7a738875785-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7a738875785-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7a738875785-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7a738875785-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7a738875785-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7a738875785-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7a738875785-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7a738875785-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7a738875785-9">
               9
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd7a738875785-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                Singleton
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7a738875785-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __new__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7a738875785-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-k ">
                hasattr
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘_instance’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7a738875785-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                orig
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                super
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                Singleton
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7a738875785-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                _instance
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                orig
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                __new__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7a738875785-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                _instance
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7a738875785-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7a738875785-8">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                MyClass
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                Singleton
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7a738875785-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3>
        2 共享属性
       </h3>
       <p>
        创建实例时把所有实例的
        <code>
         __dict__
        </code>
        指向同一个字典,这样它们具有相同的属性和方法.
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd7e330889553">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd7e330889553-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7e330889553-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7e330889553-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7e330889553-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7e330889553-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7e330889553-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7e330889553-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd7e330889553-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd7e330889553-9">
               9
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd7e330889553-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                Borg
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7e330889553-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                _state
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7e330889553-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __new__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7e330889553-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                ob
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                super
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                Borg
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                __new__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7e330889553-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                ob
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                __dict__
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                _state
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7e330889553-6">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                ob
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7e330889553-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd7e330889553-8">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                MyClass2
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                Borg
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd7e330889553-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3>
        3 装饰器版本
       </h3>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd81154074120">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd81154074120-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd81154074120-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd81154074120-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd81154074120-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd81154074120-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd81154074120-11">
               11
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd81154074120-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                singleton
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd81154074120-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                instances
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd81154074120-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                getinstance
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd81154074120-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-e">
                cls
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                instances
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd81154074120-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                instances
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                cls
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                kw
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd81154074120-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                instances
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                cls
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd81154074120-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-i">
                getinstance
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd81154074120-8">
              </div>
              <div class="crayon-line" id="crayon-575513db9dd81154074120-9">
               <span class="crayon-sy">
                @
               </span>
               <span class="crayon-e">
                singleton
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd81154074120-10">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                MyClass
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd81154074120-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-sy">
                .
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3>
        4 import方法
       </h3>
       <p>
        作为python的模块是天然的单例模式
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd84249921456">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd84249921456-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd84249921456-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd84249921456-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd84249921456-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd84249921456-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd84249921456-11">
               11
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd84249921456-1">
               <span class="crayon-c">
                # mysingleton.py
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd84249921456-2">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                My_Singleton
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd84249921456-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd84249921456-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                pass
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd84249921456-5">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd84249921456-6">
               <span class="crayon-v">
                my_singleton
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                My_Singleton
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd84249921456-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd84249921456-8">
               <span class="crayon-c">
                # to use
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd84249921456-9">
               <span class="crayon-st">
                from
               </span>
               <span class="crayon-e">
                mysingleton
               </span>
               <span class="crayon-r">
                import
               </span>
               <span class="crayon-e">
                my_singleton
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd84249921456-10">
              </div>
              <div class="crayon-line" id="crayon-575513db9dd84249921456-11">
               <span class="crayon-v">
                my_singleton
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                foo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        17 Python中的作用域
       </h2>
       <p>
        Python 中，一个变量的作用域总是由在代码中被赋值的地方所决定的。
       </p>
       <p>
        当 Python 遇到一个变量的话他会按照这样的顺序进行搜索：
       </p>
       <p>
        本地作用域（Local）→当前作用域被嵌入的本地作用域（Enclosing locals）→全局/模块作用域（Global）→内置作用域（Built-in）
       </p>
       <h2>
        18 GIL线程全局锁
       </h2>
       <p>
        线程全局锁(Global Interpreter Lock),即Python为了保证线程安全而采取的独立线程运行的限制,说白了就是一个核只能在同一时间运行一个线程.
       </p>
       <p>
        见
        <a href="http://www.oschina.net/translate/pythons-hardest-problem">
         Python 最难的问题
        </a>
       </p>
       <p>
        解决办法就是多进程和下面的协程(协程也只是单CPU,但是能减小切换代价提升性能).
       </p>
       <h2>
        19 协程
       </h2>
       <p>
        知乎被问到了,呵呵哒,跪了
       </p>
       <p>
        简单点说协程是进程和线程的升级版,进程和线程都面临着内核态和用户态的切换问题而耗费许多切换时间,而协程就是用户自己控制切换的时机,不再需要陷入系统的内核态.
       </p>
       <p>
        Python里最常见的yield就是协程的思想!可以查看第九个问题.
       </p>
       <h2>
        20 闭包
       </h2>
       <p>
        闭包(closure)是函数式编程的重要的语法结构。闭包也是一种组织代码的结构，它同样提高了代码的可重复使用性。
       </p>
       <p>
        当一个内嵌函数引用其外部作作用域的变量,我们就会得到一个闭包. 总结一下,创建一个闭包必须满足以下几点:
       </p>
       <ol>
        <li>
         必须有一个内嵌函数
        </li>
        <li>
         内嵌函数必须引用外部函数中的变量
        </li>
        <li>
         外部函数的返回值必须是内嵌函数
        </li>
       </ol>
       <p>
        感觉闭包还是有难度的,几句话是说不明白的,还是查查相关资料.
       </p>
       <p>
        重点是函数运行后并不会被撤销,就像16题的instance字典一样,当函数运行完后,instance并不被销毁,而是继续留在内存空间里.这个功能类似类里的类变量,只不过迁移到了函数上.
       </p>
       <p>
        闭包就像个空心球一样,你知道外面和里面,但你不知道中间是什么样.
       </p>
       <h2>
        21 lambda函数
       </h2>
       <p>
        其实就是一个匿名函数,为什么叫lambda?因为和后面的函数式编程有关.
       </p>
       <p>
        推荐:
        <a href="http://www.zhihu.com/question/20125256">
         知乎
        </a>
       </p>
       <h2>
        22 Python函数式编程
       </h2>
       <p>
        这个需要适当的了解一下吧,毕竟函数式编程在Python中也做了引用.
       </p>
       <p>
        推荐:
        <a href="http://coolshell.cn/articles/10822.html">
         酷壳
        </a>
       </p>
       <p>
        python中函数式编程支持:
       </p>
       <p>
        filter 函数的功能相当于过滤器。调用一个布尔函数
        <code>
         bool_func
        </code>
        来迭代遍历每个seq中的元素；返回一个使
        <code>
         bool_seq
        </code>
        返回值为true的元素的序列。
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd89738950741">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd89738950741-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd89738950741-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd89738950741-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd89738950741-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd89738950741-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                7
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd89738950741-2">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                filter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd89738950741-3">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                b
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd89738950741-4">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                7
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        map函数是对一个序列的每个项依次执行函数，下面是对一个序列每个项都乘以2：
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd8c807495536">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd8c807495536-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd8c807495536-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd8c807495536-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd8c807495536-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                map
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd8c807495536-2">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                list
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd8c807495536-3">
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        reduce函数是对一个序列的每个项迭代调用函数，下面是求3的阶乘：
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd8f919315670">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd8f919315670-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd8f919315670-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd8f919315670-1">
               <span class="crayon-o">
                &gt;&gt;&gt;
               </span>
               <span class="crayon-k ">
                reduce
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                y
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                y
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-k ">
                range
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd8f919315670-2">
               <span class="crayon-cn">
                6
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        23 Python里的拷贝
       </h2>
       <p>
        引用和copy(),deepcopy()的区别
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dd93243530932">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dd93243530932-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dd93243530932-20">
               20
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dd93243530932-1">
               <span class="crayon-r">
                import
               </span>
               <span class="crayon-k ">
                copy
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-2">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #原始对象
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-3">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-4">
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #赋值，传对象的引用
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-5">
               <span class="crayon-v">
                c
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                copy
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                copy
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #对象拷贝，浅拷贝
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-6">
               <span class="crayon-v">
                d
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                copy
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                deepcopy
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #对象拷贝，深拷贝
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-8">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #修改对象a
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-9">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #修改对象a中的[‘a’, ‘b’]数组对象
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-10">
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-11">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘a = ‘
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-i">
                a
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-12">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘b = ‘
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-i">
                b
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-13">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘c = ‘
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-i">
                c
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-14">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-s">
                ‘d = ‘
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-i">
                d
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-15">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-16">
               输出结果：
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-17">
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-18">
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dd93243530932-19">
               <span class="crayon-v">
                c
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dd93243530932-20">
               <span class="crayon-v">
                d
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        24 Python垃圾回收机制
       </h2>
       <p>
        Python GC主要使用引用计数（reference counting）来跟踪和回收垃圾。在引用计数的基础上，通过“标记-清除”（mark and sweep）解决容器对象可能产生的循环引用问题，通过“分代回收”（generation collection）以空间换时间的方法提高垃圾回收效率。
       </p>
       <h3>
        1 引用计数
       </h3>
       <p>
        PyObject是每个对象必有的内容，其中
        <code>
         ob_refcnt
        </code>
        就是做为引用计数。当一个对象有新的引用时，它的
        <code>
         ob_refcnt
        </code>
        就会增加，当引用它的对象被删除，它的
        <code>
         ob_refcnt
        </code>
        就会减少.引用计数为0时，该对象生命就结束了。
       </p>
       <p>
        优点:
       </p>
       <ol>
        <li>
         简单
        </li>
        <li>
         实时性
        </li>
       </ol>
       <p>
        缺点:
       </p>
       <ol>
        <li>
         维护引用计数消耗资源
        </li>
        <li>
         循环引用
        </li>
       </ol>
       <h3>
        2 标记-清除机制
       </h3>
       <p>
        基本思路是先按需分配，等到没有空闲内存的时候从寄存器和程序栈上的引用出发，遍历以对象为节点、以引用为边构成的图，把所有可以访问到的对象打上标记，然后清扫一遍内存空间，把所有没标记的对象释放。
       </p>
       <h3>
        3 分代技术
       </h3>
       <p>
        分代回收的整体思想是：将系统中的所有内存块根据其存活时间划分为不同的集合，每个集合就成为一个“代”，垃圾收集频率随着“代”的存活时间的增大而减小，存活时间通常利用经过几次垃圾回收来度量。
       </p>
       <p>
        Python默认定义了三代对象集合，索引数越大，对象存活时间越长。
       </p>
       <p>
        举例：
        <br/>
        当某些内存块M经过了3次垃圾收集的清洗之后还存活时，我们就将内存块M划到一个集合A中去，而新分配的内存都划分到集合B中去。当垃圾收集开始工作时，大多数情况都只对集合B进行垃圾回收，而对集合A进行垃圾回收要隔相当长一段时间后才进行，这就使得垃圾收集机制需要处理的内存少了，效率自然就提高了。在这个过程中，集合B中的某些内存块由于存活时间长而会被转移到集合A中，当然，集合A中实际上也存在一些垃圾，这些垃圾的回收会因为这种分代的机制而被延迟。
       </p>
       <h2>
        25 Python的List
       </h2>
       <p>
        推荐: http://www.jianshu.com/p/J4U6rR
       </p>
       <h2>
        26 Python的is
       </h2>
       <p>
        is是对比地址,==是对比值
       </p>
       <h2>
        27 read,readline和readlines
       </h2>
       <ul>
        <li>
         read 读取整个文件
        </li>
        <li>
         readline 读取下一行,使用生成器方法
        </li>
        <li>
         readlines 读取整个文件到一个迭代器以供我们遍历
        </li>
       </ul>
       <h2>
        28 Python2和3的区别
       </h2>
       <p>
        推荐：《
        <a href="http://python.jobbole.com/80006/" target="_blank">
         Python 2.7.x 和 3.x 版本的重要区别
        </a>
        》
       </p>
       <h1>
        操作系统
       </h1>
       <h2>
        1 select,poll和epoll
       </h2>
       <p>
        其实所有的I/O都是轮询的方法,只不过实现的层面不同罢了.
       </p>
       <p>
        这个问题可能有点深入了,但相信能回答出这个问题是对I/O多路复用有很好的了解了.其中tornado使用的就是epoll的.
       </p>
       <p>
        <a href="http://www.cnblogs.com/Anker/p/3265058.html">
         selec,poll和epoll区别总结
        </a>
       </p>
       <p>
        基本上select有3个缺点:
       </p>
       <ol>
        <li>
         连接数受限
        </li>
        <li>
         查找配对速度慢
        </li>
        <li>
         数据由内核拷贝到用户态
        </li>
       </ol>
       <p>
        poll改善了第一个缺点
       </p>
       <p>
        epoll改了三个缺点.
       </p>
       <p>
        关于epoll的: http://www.cnblogs.com/my_life/articles/3968782.html
       </p>
       <h2>
        2 调度算法
       </h2>
       <ol>
        <li>
         先来先服务(FCFS, First Come First Serve)
        </li>
        <li>
         短作业优先(SJF, Shortest Job First)
        </li>
        <li>
         最高优先权调度(Priority Scheduling)
        </li>
        <li>
         时间片轮转(RR, Round Robin)
        </li>
        <li>
         多级反馈队列调度(multilevel feedback queue scheduling)
        </li>
       </ol>
       <p>
        实时调度算法:
       </p>
       <ol>
        <li>
         最早截至时间优先 EDF
        </li>
        <li>
         最低松弛度优先 LLF
        </li>
       </ol>
       <h2>
        3 死锁
       </h2>
       <p>
        原因:
       </p>
       <ol>
        <li>
         竞争资源
        </li>
        <li>
         程序推进顺序不当
        </li>
       </ol>
       <p>
        必要条件:
       </p>
       <ol>
        <li>
         互斥条件
        </li>
        <li>
         请求和保持条件
        </li>
        <li>
         不剥夺条件
        </li>
        <li>
         环路等待条件
        </li>
       </ol>
       <p>
        处理死锁基本方法:
       </p>
       <ol>
        <li>
         预防死锁(摒弃除1以外的条件)
        </li>
        <li>
         避免死锁(银行家算法)
        </li>
        <li>
         检测死锁(资源分配图)
        </li>
        <li>
         解除死锁
         <ol>
          <li>
           剥夺资源
          </li>
          <li>
           撤销进程
          </li>
         </ol>
        </li>
       </ol>
       <h2>
        4 程序编译与链接
       </h2>
       <p>
        推荐: http://www.ruanyifeng.com/blog/2014/11/compiler.html
       </p>
       <p>
        Bulid过程可以分解为4个步骤:预处理(Prepressing), 编译(Compilation)、汇编(Assembly)、链接(Linking)
       </p>
       <p>
        以c语言为例:
       </p>
       <h3>
        1 预处理
       </h3>
       <p>
        预编译过程主要处理那些源文件中的以“#”开始的预编译指令，主要处理规则有：
       </p>
       <ol>
        <li>
         将所有的“#define”删除，并展开所用的宏定义
        </li>
        <li>
         处理所有条件预编译指令，比如“#if”、“#ifdef”、 “#elif”、“#endif”
        </li>
        <li>
         处理“#include”预编译指令，将被包含的文件插入到该编译指令的位置，注：此过程是递归进行的
        </li>
        <li>
         删除所有注释
        </li>
        <li>
         添加行号和文件名标识，以便于编译时编译器产生调试用的行号信息以及用于编译时产生编译错误或警告时可显示行号
        </li>
        <li>
         保留所有的#pragma编译器指令。
        </li>
       </ol>
       <h3>
        2 编译
       </h3>
       <p>
        编译过程就是把预处理完的文件进行一系列的词法分析、语法分析、语义分析及优化后生成相应的汇编代码文件。这个过程是整个程序构建的核心部分。
       </p>
       <h3>
        3 汇编
       </h3>
       <p>
        汇编器是将汇编代码转化成机器可以执行的指令，每一条汇编语句几乎都是一条机器指令。经过编译、链接、汇编输出的文件成为目标文件(Object File)
       </p>
       <h3>
        4 链接
       </h3>
       <p>
        链接的主要内容就是把各个模块之间相互引用的部分处理好，使各个模块可以正确的拼接。
        <br/>
        链接的主要过程包块 地址和空间的分配（Address and Storage Allocation）、符号决议(Symbol Resolution)和重定位(Relocation)等步骤。
       </p>
       <h2>
        5 静态链接和动态链接
       </h2>
       <p>
        静态链接方法：静态链接的时候，载入代码就会把程序会用到的动态代码或动态代码的地址确定下来
        <br/>
        静态库的链接可以使用静态链接，动态链接库也可以使用这种方法链接导入库
       </p>
       <p>
        动态链接方法：使用这种方式的程序并不在一开始就完成动态链接，而是直到真正调用动态库代码时，载入程序才计算(被调用的那部分)动态代码的逻辑地址，然后等到某个时候，程序又需要调用另外某块动态代码时，载入程序又去计算这部分代码的逻辑地址，所以，这种方式使程序初始化时间较短，但运行期间的性能比不上静态链接的程序
       </p>
       <h2>
        6 虚拟内存技术
       </h2>
       <p>
        虚拟存储器是值具有请求调入功能和置换功能,能从逻辑上对内存容量加以扩充的一种存储系统.
       </p>
       <h2>
        7 分页和分段
       </h2>
       <p>
        分页: 用户程序的地址空间被划分成若干固定大小的区域，称为“页”，相应地，内存空间分成若干个物理块，页和块的大小相等。可将用户程序的任一页放在内存的任一块中，实现了离散分配。
       </p>
       <p>
        分段: 将用户程序地址空间分成若干个大小不等的段，每段可以定义一组相对完整的逻辑信息。存储分配时，以段为单位，段与段在内存中可以不相邻接，也实现了离散分配。
       </p>
       <h3>
        分页与分段的主要区别
       </h3>
       <ol>
        <li>
         页是信息的物理单位,分页是为了实现非连续分配,以便解决内存碎片问题,或者说分页是由于系统管理的需要.段是信息的逻辑单位,它含有一组意义相对完整的信息,分段的目的是为了更好地实现共享,满足用户的需要.
        </li>
        <li>
         页的大小固定,由系统确定,将逻辑地址划分为页号和页内地址是由机器硬件实现的.而段的长度却不固定,决定于用户所编写的程序,通常由编译程序在对源程序进行编译时根据信息的性质来划分.
        </li>
        <li>
         分页的作业地址空间是一维的.分段的地址空间是二维的.
        </li>
       </ol>
       <h2>
        8 页面置换算法
       </h2>
       <ol>
        <li>
         最佳置换算法OPT:不可能实现
        </li>
        <li>
         先进先出FIFO
        </li>
        <li>
         最近最久未使用算法LRU:最近一段时间里最久没有使用过的页面予以置换.
        </li>
        <li>
         clock算法
        </li>
       </ol>
       <h2>
        9 边沿触发和水平触发
       </h2>
       <p>
        边缘触发是指每当状态变化时发生一个 io 事件，条件触发是只要满足条件就发生一个 io 事件
       </p>
       <h1>
        数据库
       </h1>
       <h2>
        1 事务
       </h2>
       <p>
        数据库事务(Database Transaction) ，是指作为单个逻辑工作单元执行的一系列操作，要么完全地执行，要么完全地不执行。
       </p>
       <h2>
        2 数据库索引
       </h2>
       <p>
        推荐: http://tech.meituan.com/mysql-index.html
       </p>
       <p>
        <a href="http://blog.jobbole.com/24006/" target="_blank">
         MySQL索引背后的数据结构及算法原理
        </a>
       </p>
       <p>
        聚集索引,非聚集索引,B-Tree,B+Tree,最左前缀原理
       </p>
       <h2>
        3 Redis原理
       </h2>
       <h2>
        4 乐观锁和悲观锁
       </h2>
       <p>
        悲观锁：假定会发生并发冲突，屏蔽一切可能违反数据完整性的操作
       </p>
       <p>
        乐观锁：假设不会发生并发冲突，只在提交操作时检查是否违反数据完整性。
       </p>
       <h2>
        5 MVCC
       </h2>
       <h2>
        6 MyISAM和InnoDB
       </h2>
       <p>
        MyISAM 适合于一些需要大量查询的应用，但其对于有大量写操作并不是很好。甚至你只是需要update一个字段，整个表都会被锁起来，而别的进程，就算是读进程都无法操作直到读操作完成。另外，MyISAM 对于 SELECT COUNT(*) 这类的计算是超快无比的。
       </p>
       <p>
        InnoDB 的趋势会是一个非常复杂的存储引擎，对于一些小的应用，它会比 MyISAM 还慢。他是它支持“行锁” ，于是在写操作比较多的时候，会更优秀。并且，他还支持更多的高级应用，比如：事务。
       </p>
       <h1>
        网络
       </h1>
       <h2>
        1 三次握手
       </h2>
       <ol>
        <li>
         客户端通过向服务器端发送一个SYN来创建一个主动打开，作为三路握手的一部分。客户端把这段连接的序号设定为随机数 A。
        </li>
        <li>
         服务器端应当为一个合法的SYN回送一个SYN/ACK。ACK 的确认码应为 A+1，SYN/ACK 包本身又有一个随机序号 B。
        </li>
        <li>
         最后，客户端再发送一个ACK。当服务端受到这个ACK的时候，就完成了三路握手，并进入了连接创建状态。此时包序号被设定为收到的确认号 A+1，而响应则为 B+1。
        </li>
       </ol>
       <h2>
        2 四次挥手
       </h2>
       <h2>
        3 ARP协议
       </h2>
       <p>
        地址解析协议(Address Resolution Protocol): 根据IP地址获取物理地址的一个TCP/IP协议
       </p>
       <h2>
        4 urllib和urllib2的区别
       </h2>
       <p>
        这个面试官确实问过,当时答的urllib2可以Post而urllib不可以.
       </p>
       <ol>
        <li>
         urllib提供urlencode方法用来GET查询字符串的产生，而urllib2没有。这是为何urllib常和urllib2一起使用的原因。
        </li>
        <li>
         urllib2可以接受一个Request类的实例来设置URL请求的headers，urllib仅可以接受URL。这意味着，你不可以伪装你的User Agent字符串等。
        </li>
       </ol>
       <h2>
        5 Post和Get
       </h2>
       <p>
        <a href="http://www.cnblogs.com/nankezhishi/archive/2012/06/09/getandpost.html">
         GET和POST有什么区别？及为什么网上的多数答案都是错的
        </a>
       </p>
       <p>
        get:
        <a href="http://tools.ietf.org/html/rfc2616#section-9.3">
         RFC 2616 – Hypertext Transfer Protocol — HTTP/1.1
        </a>
        <br/>
        post:
        <a href="http://tools.ietf.org/html/rfc2616#section-9.5">
         RFC 2616 – Hypertext Transfer Protocol — HTTP/1.1
        </a>
       </p>
       <h2>
        6 Cookie和Session
       </h2>
       <table>
        <thead>
         <tr>
          <th>
          </th>
          <th>
           Cookie
          </th>
          <th>
           Session
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           储存位置
          </td>
          <td>
           客户端
          </td>
          <td>
           服务器端
          </td>
         </tr>
         <tr>
          <td>
           目的
          </td>
          <td>
           跟踪会话，也可以保存用户偏好设置或者保存用户名密码等
          </td>
          <td>
           跟踪会话
          </td>
         </tr>
         <tr>
          <td>
           安全性
          </td>
          <td>
           不安全
          </td>
          <td>
           安全
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        session技术是要使用到cookie的，之所以出现session技术，主要是为了安全。
       </p>
       <h2>
        7 apache和nginx的区别
       </h2>
       <p>
        nginx 相对 apache 的优点：
       </p>
       <ul>
        <li>
         轻量级，同样起web 服务，比apache 占用更少的内存及资源
        </li>
        <li>
         抗并发，nginx 处理请求是异步非阻塞的，支持更多的并发连接，而apache 则是阻塞型的，在高并发下nginx 能保持低资源低消耗高性能
        </li>
        <li>
         配置简洁
        </li>
        <li>
         高度模块化的设计，编写模块相对简单
        </li>
        <li>
         社区活跃
        </li>
       </ul>
       <p>
        apache 相对nginx 的优点：
       </p>
       <ul>
        <li>
         rewrite ，比nginx 的rewrite 强大
        </li>
        <li>
         模块超多，基本想到的都可以找到
        </li>
        <li>
         少bug ，nginx 的bug 相对较多
        </li>
        <li>
         超稳定
        </li>
       </ul>
       <h2>
        8 网站用户密码保存
       </h2>
       <ol>
        <li>
         明文保存
        </li>
        <li>
         明文hash后保存,如md5
        </li>
        <li>
         MD5+Salt方式,这个salt可以随机
        </li>
        <li>
         知乎使用了Bcrypy(好像)加密
        </li>
       </ol>
       <h2>
        9 HTTP和HTTPS
       </h2>
       <table>
        <thead>
         <tr>
          <th>
           状态码
          </th>
          <th>
           定义
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           1xx 报告
          </td>
          <td>
           接收到请求，继续进程
          </td>
         </tr>
         <tr>
          <td>
           2xx 成功
          </td>
          <td>
           步骤成功接收，被理解，并被接受
          </td>
         </tr>
         <tr>
          <td>
           3xx 重定向
          </td>
          <td>
           为了完成请求,必须采取进一步措施
          </td>
         </tr>
         <tr>
          <td>
           4xx 客户端出错
          </td>
          <td>
           请求包括错的顺序或不能完成
          </td>
         </tr>
         <tr>
          <td>
           5xx 服务器出错
          </td>
          <td>
           服务器无法完成显然有效的请求
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        403: Forbidden
        <br/>
        404: Not Found
       </p>
       <p>
        HTTPS握手,对称加密,非对称加密,TLS/SSL,RSA
       </p>
       <h2>
        10 XSRF和XSS
       </h2>
       <ul>
        <li>
         CSRF(Cross-site request forgery)跨站请求伪造
        </li>
        <li>
         XSS(Cross Site Scripting)跨站脚本攻击
        </li>
       </ul>
       <p>
        CSRF重点在请求,XSS重点在脚本
       </p>
       <h2>
        11 幂等 Idempotence
       </h2>
       <p>
        HTTP方法的幂等性是指一次和多次请求某一个资源应该具有同样的
        <strong>
         副作用
        </strong>
        。(注意是副作用)
       </p>
       <p>
        <code>
         GET http://www.bank.com/account/123456
        </code>
        ，不会改变资源的状态，不论调用一次还是N次都没有副作用。请注意，这里强调的是一次和N次具有相同的副作用，而不是每次GET的结果相同。
        <code>
         GET http://www.news.com/latest-news
        </code>
        这个HTTP请求可能会每次得到不同的结果，但它本身并没有产生任何副作用，因而是满足幂等性的。
       </p>
       <p>
        DELETE方法用于删除资源，有副作用，但它应该满足幂等性。比如：
        <code>
         DELETE http://www.forum.com/article/4231
        </code>
        ，调用一次和N次对系统产生的副作用是相同的，即删掉id为4231的帖子；因此，调用者可以多次调用或刷新页面而不必担心引起错误。
       </p>
       <p>
        POST所对应的URI并非创建的资源本身，而是资源的接收者。比如：
        <code>
         POST http://www.forum.com/articles
        </code>
        的语义是在
        <code>
         http://www.forum.com/articles
        </code>
        下创建一篇帖子，HTTP响应中应包含帖子的创建状态以及帖子的URI。两次相同的POST请求会在服务器端创建两份资源，它们具有不同的URI；所以，POST方法不具备幂等性。
       </p>
       <p>
        PUT所对应的URI是要创建或更新的资源本身。比如：
        <code>
         PUT http://www.forum/articles/4231
        </code>
        的语义是创建或更新ID为4231的帖子。对同一URI进行多次PUT的副作用和一次PUT是相同的；因此，PUT方法具有幂等性。
       </p>
       <h2>
        12 RESTful架构(SOAP,RPC)
       </h2>
       <p>
        推荐: http://www.ruanyifeng.com/blog/2011/09/restful.html
       </p>
       <h2>
        13 SOAP
       </h2>
       <p>
        SOAP（原为Simple Object Access Protocol的首字母缩写，即简单对象访问协议）是交换数据的一种协议规范，使用在计算机网络Web服务（web service）中，交换带结构信息。SOAP为了简化网页服务器（Web Server）从XML数据库中提取数据时，节省去格式化页面时间，以及不同应用程序之间按照HTTP通信协议，遵从XML格式执行资料互换，使其抽象于语言实现、平台和硬件。
       </p>
       <h2>
        14 RPC
       </h2>
       <p>
        RPC（Remote Procedure Call Protocol）——远程过程调用协议，它是一种通过网络从远程计算机程序上请求服务，而不需要了解底层网络技术的协议。RPC协议假定某些传输协议的存在，如TCP或UDP，为通信程序之间携带信息数据。在OSI网络通信模型中，RPC跨越了传输层和应用层。RPC使得开发包括网络分布式多程序在内的应用程序更加容易。
       </p>
       <p>
        总结:服务提供的两大流派.传统意义以方法调用为导向通称RPC。为了企业SOA,若干厂商联合推出webservice,制定了wsdl接口定义,传输soap.当互联网时代,臃肿SOA被简化为http+xml/json.但是简化出现各种混乱。以资源为导向,任何操作无非是对资源的增删改查，于是统一的REST出现了.
       </p>
       <p>
        进化的顺序: RPC -&gt; SOAP -&gt; RESTful
       </p>
       <h2>
        15 CGI和WSGI
       </h2>
       <p>
        CGI是通用网关接口，是连接web服务器和应用程序的接口，用户通过CGI来获取动态数据或文件等。
        <br/>
        CGI程序是一个独立的程序，它可以用几乎所有语言来写，包括perl，c，lua，python等等。
       </p>
       <p>
        WSGI, Web Server Gateway Interface，是Python应用程序或框架和Web服务器之间的一种接口，WSGI的其中一个目的就是让用户可以用统一的语言(Python)编写前后端。
       </p>
       <p>
        官方说明：
        <a href="https://www.python.org/dev/peps/pep-3333/">
         PEP-3333
        </a>
       </p>
       <h2>
        16 中间人攻击
       </h2>
       <p>
        在GFW里屡见不鲜的,呵呵.
       </p>
       <p>
        中间人攻击（Man-in-the-middle attack，通常缩写为MITM）是指攻击者与通讯的两端分别创建独立的联系，并交换其所收到的数据，使通讯的两端认为他们正在通过一个私密的连接与对方直接对话，但事实上整个会话都被攻击者完全控制。
       </p>
       <h2>
        17 c10k问题
       </h2>
       <p>
        所谓c10k问题，指的是服务器同时支持成千上万个客户端的问题，也就是concurrent 10 000 connection（这也是c10k这个名字的由来）。
        <br/>
        推荐: http://www.kegel.com/c10k.html
       </p>
       <h2>
        18 socket
       </h2>
       <p>
        推荐: http://www.cnblogs.com/bingyun84/archive/2009/10/16/1584387.html
       </p>
       <p>
        Socket=Ip address+ TCP/UDP + port
       </p>
       <h2>
        19 浏览器缓存
       </h2>
       <p>
        推荐:
        <a href="http://web.jobbole.com/84367/" target="_blank">
         http://web.jobbole.com/84367/
        </a>
       </p>
       <p>
        304 Not Modified
       </p>
       <h2>
        20 HTTP1.0和HTTP1.1
       </h2>
       <p>
        推荐: http://blog.csdn.net/elifefly/article/details/3964766
       </p>
       <ol>
        <li>
         请求头Host字段,一个服务器多个网站
        </li>
        <li>
         长链接
        </li>
        <li>
         文件断点续传
        </li>
        <li>
         身份认证,状态管理,Cache缓存
        </li>
       </ol>
       <h2>
        21 Ajax
       </h2>
       <p>
        AJAX,Asynchronous JavaScript and XML（异步的 JavaScript 和 XML）, 是与在不重新加载整个页面的情况下，与服务器交换数据并更新部分网页的技术。
       </p>
       <h1>
        *NIX
       </h1>
       <h2>
        unix进程间通信方式(IPC)
       </h2>
       <ol>
        <li>
         管道（Pipe）：管道可用于具有亲缘关系进程间的通信，允许一个进程和另一个与它有共同祖先的进程之间进行通信。
        </li>
        <li>
         命名管道（named pipe）：命名管道克服了管道没有名字的限制，因此，除具有管道所具有的功能外，它还允许无亲缘关系进程间的通信。命名管道在文件系统中有对应的文件名。命名管道通过命令mkfifo或系统调用mkfifo来创建。
        </li>
        <li>
         信号（Signal）：信号是比较复杂的通信方式，用于通知接受进程有某种事件发生，除了用于进程间通信外，进程还可以发送信号给进程本身；linux除了支持Unix早期信号语义函数sigal外，还支持语义符合Posix.1标准的信号函数sigaction（实际上，该函数是基于BSD的，BSD为了实现可靠信号机制，又能够统一对外接口，用sigaction函数重新实现了signal函数）。
        </li>
        <li>
         消息（Message）队列：消息队列是消息的链接表，包括Posix消息队列system V消息队列。有足够权限的进程可以向队列中添加消息，被赋予读权限的进程则可以读走队列中的消息。消息队列克服了信号承载信息量少，管道只能承载无格式字节流以及缓冲区大小受限等缺
        </li>
        <li>
         共享内存：使得多个进程可以访问同一块内存空间，是最快的可用IPC形式。是针对其他通信机制运行效率较低而设计的。往往与其它通信机制，如信号量结合使用，来达到进程间的同步及互斥。
        </li>
        <li>
         内存映射（mapped memory）：内存映射允许任何多个进程间通信，每一个使用该机制的进程通过把一个共享的文件映射到自己的进程地址空间来实现它。
        </li>
        <li>
         信号量（semaphore）：主要作为进程间以及同一进程不同线程之间的同步手段。
        </li>
        <li>
         套接口（Socket）：更为一般的进程间通信机制，可用于不同机器之间的进程间通信。起初是由Unix系统的BSD分支开发出来的，但现在一般可以移植到其它类Unix系统上：Linux和System V的变种都支持套接字。
        </li>
       </ol>
       <h1>
        数据结构
       </h1>
       <h2>
        1 红黑树
       </h2>
       <p>
        红黑树与AVL的比较：
       </p>
       <p>
        AVL是严格平衡树，因此在增加或者删除节点的时候，根据不同情况，旋转的次数比红黑树要多；
       </p>
       <p>
        红黑是用非严格的平衡来换取增删节点时候旋转次数的降低；
       </p>
       <p>
        所以简单说，如果你的应用中，搜索的次数远远大于插入和删除，那么选择AVL，如果搜索，插入删除次数几乎差不多，应该选择RB。
       </p>
       <h1>
        编程题
       </h1>
       <h2>
        1 台阶问题/斐波纳挈
       </h2>
       <p>
        一只青蛙一次可以跳上1级台阶，也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法。
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dda2611950446">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dda2611950446-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dda2611950446-1">
               <span class="crayon-v">
                fib
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-i">
                n
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                &lt;=
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        第二种记忆方法
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dda9760648065">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dda9760648065-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dda9760648065-14">
               14
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dda9760648065-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                memo
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                func
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cache
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                wrap
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-e">
                args
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                cache
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cache
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                func
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                cache
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                args
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-i">
                wrap
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-8">
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-9">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-10">
               <span class="crayon-sy">
                @
               </span>
               <span class="crayon-e">
                memo
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-11">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dda9760648065-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dda9760648065-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        第三种方法
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddad637759193">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddad637759193-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddad637759193-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddad637759193-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddad637759193-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddad637759193-5">
               5
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddad637759193-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddad637759193-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddad637759193-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                _
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                xrange
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddad637759193-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                a
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-i">
                b
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddad637759193-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                b
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        2 变态台阶问题
       </h2>
       <p>
        一只青蛙一次可以跳上1级台阶，也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddb0660232516">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddb0660232516-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddb0660232516-1">
               <span class="crayon-v">
                fib
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-i">
                n
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-e">
                fib
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        3 矩形覆盖
       </h2>
       <p>
        我们可以用
        <code>
         2*1
        </code>
        的小矩形横着或者竖着去覆盖更大的矩形。请问用n个
        <code>
         2*1
        </code>
        的小矩形无重叠地覆盖一个
        <code>
         2*n
        </code>
        的大矩形，总共有多少种方法？
       </p>
       <blockquote>
        <p>
         第
         <code>
          2*n
         </code>
         个矩形的覆盖方法等于第
         <code>
          2*(n-1)
         </code>
         加上第
         <code>
          2*(n-2)
         </code>
         的方法。
        </p>
       </blockquote>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddb3951931704">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddb3951931704-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddb3951931704-1">
               <span class="crayon-v">
                f
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-r">
                lambda
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-e">
                f
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e">
                f
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                n
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        4 杨氏矩阵查找
       </h2>
       <p>
        在一个m行n列二维数组中，每一行都按照从左到右递增的顺序排序，每一列都按照从上到下递增的顺序排序。请完成一个函数，输入这样的一个二维数组和一个整数，判断数组中是否含有该整数。
       </p>
       <h2>
        5 去除列表中的重复元素
       </h2>
       <p>
        用集合
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddbb747296661">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddbb747296661-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddbb747296661-1">
               <span class="crayon-k ">
                list
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                set
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        用字典
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddbe587569605">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddbe587569605-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddbe587569605-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddbe587569605-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddbe587569605-1">
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘d’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddbe587569605-2">
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                fromkeys
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                keys
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddbe587569605-3">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                l2
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        用字典并保持顺序
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddc1252987698">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddc1252987698-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc1252987698-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc1252987698-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc1252987698-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddc1252987698-1">
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘d’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc1252987698-2">
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                list
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                set
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc1252987698-3">
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                sort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                key
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc1252987698-4">
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                l2
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        列表推导式
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddc4900355394">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddc4900355394-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc4900355394-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc4900355394-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddc4900355394-1">
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘d’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘b’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘c’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘a’
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc4900355394-2">
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc4900355394-3">
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                i
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-e">
                l1
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-i">
                i
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        面试官提到的,先排序然后删除.
       </p>
       <h2>
        6 链表成对调换
       </h2>
       <p>
        <code>
         1-&gt;2-&gt;3-&gt;4
        </code>
        转换成
        <code>
         2-&gt;1-&gt;4-&gt;3
        </code>
        .
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddc7028406961">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddc7028406961-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddc7028406961-15">
               15
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                ListNode
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __init__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                val
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-i">
                x
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-5">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-6">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                Solution
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # @param a ListNode
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # @return a ListNode
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                swapPairs
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                head
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                head
               </span>
               <span class="crayon-o">
                !=
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-v">
                head
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                !=
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                head
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                head
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                swapPairs
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                head
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddc7028406961-14">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddc7028406961-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                head
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        7 创建字典的方法
       </h2>
       <h3>
        1 直接创建
       </h3>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddca983945179">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddca983945179-1">
               1
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddca983945179-1">
               <span class="crayon-k ">
                dict
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                ‘name’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                ‘earth’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘port’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                ’80’
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3>
        2 工厂方法
       </h3>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddcd205908232">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddcd205908232-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddcd205908232-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddcd205908232-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddcd205908232-1">
               <span class="crayon-v">
                items
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘name’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘earth’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘port’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ’80’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddcd205908232-2">
               <span class="crayon-v">
                dict2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                dict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                items
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddcd205908232-3">
               <span class="crayon-v">
                dict1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                dict
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘name’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘earth’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                ‘port’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ’80’
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h3>
        3 fromkeys()方法
       </h3>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddd1807579237">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddd1807579237-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddd1807579237-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddd1807579237-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddd1807579237-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddd1807579237-1">
               <span class="crayon-v">
                dict1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                fromkeys
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘x’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘y’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddd1807579237-2">
               <span class="crayon-k ">
                dict
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                ‘x’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘y’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddd1807579237-3">
               <span class="crayon-v">
                dict2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                fromkeys
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘x’
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘y’
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddd1807579237-4">
               <span class="crayon-v">
                dict2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                ‘x’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                ‘y’
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        8 合并两个有序列表
       </h2>
       <p>
        知乎远程面试要求编程
       </p>
       <p>
        尾递归
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dddf221048926">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dddf221048926-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dddf221048926-16">
               16
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dddf221048926-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                _recursion_merge_sort2
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-k ">
                len
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-st">
                or
               </span>
               <span class="crayon-k ">
                len
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                extend
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                extend
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                tmp
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-6">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                del
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                del
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                _recursion_merge_sort2
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-14">
              </div>
              <div class="crayon-line" id="crayon-575513db9dddf221048926-15">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                recursion_merge_sort2
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dddf221048926-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                _recursion_merge_sort2
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <p>
        循环算法
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dde4803442877">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde4803442877-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde4803442877-12">
               12
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dde4803442877-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                loop_merge_sort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde4803442877-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-k ">
                len
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-k ">
                len
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde4803442877-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                del
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde4803442877-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde4803442877-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                del
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                extend
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde4803442877-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                extend
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde4803442877-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                tmp
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        9 交叉链表求交点
       </h2>
       <p>
        去哪儿的面试,没做出来.
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9dde8438005808">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-575513db9dde8438005808-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9dde8438005808-26">
               26
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9dde8438005808-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-v">
                ListNode
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __init__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                val
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-i">
                x
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-5">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                length1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                lenth2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # 求两个链表长度
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                length1
               </span>
               <span class="crayon-o">
                +=
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                length2
               </span>
               <span class="crayon-o">
                +=
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                # 长的链表先走
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                length1
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                lenth2
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                _
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                range
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                length1
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-v">
                length2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                _
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                range
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                length2
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-v">
                length1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-20">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-21">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-e">
                l1
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-22">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-23">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-24">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9dde8438005808-25">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l1
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9dde8438005808-26">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                l2
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        10 二分查找
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddeb199713487">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddeb199713487-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddeb199713487-19">
               19
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                binarySearch
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                t
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                high
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-k ">
                len
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                high
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                high
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-5">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                mid
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-v">
                high
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-cn">
                2
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                mid
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                t
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                high
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                mid
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-8">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                elif
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                mid
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                t
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                mid
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                mid
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-12">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                low
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                low
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-i">
                t
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-t">
                False
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-13">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-14">
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                __name__
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-s">
                ‘__main__’
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                12
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                45
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                66
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                99
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                120
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                444
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-e">
                binarySearch
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                12
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-e">
                binarySearch
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddeb199713487-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-e">
                binarySearch
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                13
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddeb199713487-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-e">
                binarySearch
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                l
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                444
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        11 快排
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddf2534525610">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf2534525610-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf2534525610-12">
               12
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                qsort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pivot
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                lesser
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                qsort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-i">
                x
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                x
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                pivot
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                greater
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                qsort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-i">
                x
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                x
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                x
               </span>
               <span class="crayon-o">
                &gt;=
               </span>
               <span class="crayon-v">
                pivot
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                lesser
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                pivot
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e">
                greater
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-9">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-10">
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                __name__
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-s">
                ‘__main__’
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf2534525610-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                78
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                9
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-cn">
                65
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                12
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf2534525610-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                qsort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                seq
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        12 找零问题
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9ddf6570604806">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9ddf6570604806-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9ddf6570604806-20">
               20
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                coinChange
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                values
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                money
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #values    T[1:n]数组
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #valuesCounts   钱币对应的种类数
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #money  找出来的总钱数
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #coinsUsed   对应于目前钱币总数i所使用的硬币数目
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-e">
                cents
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                range
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                money
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                minCoins
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-c">
                #从第一个开始到money的所有情况初始
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-e">
                value
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-v">
                values
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                value
               </span>
               <span class="crayon-o">
                &lt;=
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                temp
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-o">
                –
               </span>
               <span class="crayon-v">
                value
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                temp
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-v">
                minCoins
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                minCoins
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                temp
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-13">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                minCoins
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-14">
               <span class="crayon-e">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                ‘面值为：{0} 的最小硬币数目为：{1} ‘
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                format
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                cents
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-15">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-16">
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                __name__
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-s">
                ‘__main__’
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                values
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                25
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                21
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                money
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-cn">
                63
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9ddf6570604806-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-i">
                i
               </span>
               <span class="crayon-st">
                in
               </span>
               <span class="crayon-k ">
                range
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                money
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9ddf6570604806-20">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                coinChange
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                values
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                money
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                coinsUsed
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        13 广度遍历和深度遍历二叉树
       </h2>
       <p>
        给定一个数组，构建二叉树，并且按层次打印这个二叉树
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9de06495489365">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-26">
               26
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-27">
               27
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-28">
               28
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de06495489365-29">
               29
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de06495489365-30">
               30
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9de06495489365-1">
               <span class="crayon-c">
                ## 14 二叉树节点
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-2">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __init__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                data
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-5">
               <span class="crayon-e">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                left
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-6">
               <span class="crayon-e">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                right
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-8">
               <span class="crayon-v">
                tree
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                7
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-9">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-10">
               <span class="crayon-c">
                ## 15 层次遍历
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-11">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                lookup
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stack
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                stack
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                stack
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pop
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                data
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-16">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stack
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stack
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                append
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                current
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-20">
               <span class="crayon-c">
                ## 16 深度遍历
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-21">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-22">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-23">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-24">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                data
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-25">
               <span class="crayon-e">
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-26">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-27">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-28">
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                __name__
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-s">
                ‘__main__’
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de06495489365-29">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                lookup
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                tree
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de06495489365-30">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                tree
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        17 前中后序遍历
       </h2>
       <p>
        深度遍历改变顺序就OK了
       </p>
       <h2>
        18 求最大树深
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9de0a079829427">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9de0a079829427-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de0a079829427-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de0a079829427-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de0a079829427-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9de0a079829427-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                maxDepth
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de0a079829427-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de0a079829427-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-cn">
                0
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de0a079829427-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-k ">
                max
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                maxDepth
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                maxDepth
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        19 求两棵树是否相同
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9de10753141766">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9de10753141766-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de10753141766-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de10753141766-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de10753141766-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de10753141766-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de10753141766-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de10753141766-7">
               7
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9de10753141766-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                isSameTree
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                p
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de10753141766-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-v">
                p
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de10753141766-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-t">
                True
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de10753141766-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                elif
               </span>
               <span class="crayon-i">
                p
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de10753141766-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-v">
                p
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                val
               </span>
               <span class="crayon-o">
                ==
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                val
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-e">
                isSameTree
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                p
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-e">
                isSameTree
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                p
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                q
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de10753141766-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                else
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de10753141766-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-t">
                False
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        20 前序中序求后序
       </h2>
       <p>
        推荐: http://blog.csdn.net/hinyunsin/article/details/6315502
       </p>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9de13008588005">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de13008588005-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de13008588005-15">
               15
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9de13008588005-1">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                rebuild
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                center
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                center
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                index
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                rebuild
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                center
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                rebuild
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                center
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                index
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                cur
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-9">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-10">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                if
               </span>
               <span class="crayon-st">
                not
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                return
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                left
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de13008588005-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                deep
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                right
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de13008588005-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                data
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <h2>
        21 单链表逆置
       </h2>
       <div class="crayon-syntax crayon-theme-github crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-always" id="crayon-575513db9de17592013321">
        <div class="crayon-toolbar" data-settings=" show">
         <div class="crayon-tools">
          <div class="crayon-button crayon-nums-button crayon-pressed" title="切换是否显示行编号">
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
          </div>
          <p>
           <span class="crayon-language">
            Python
           </span>
          </p>
         </div>
        </div>
        <div class="crayon-plain-wrap">
        </div>
        <div class="crayon-main">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content">
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-575513db9de17592013321-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-575513db9de17592013321-22">
               22
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre">
              <div class="crayon-line" id="crayon-575513db9de17592013321-1">
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-k ">
                object
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                __init__
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                data
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-4">
               <span class="crayon-e">
               </span>
               <span class="crayon-r">
                self
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-5">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-6">
               <span class="crayon-v">
                link
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                5
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                7
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                8
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                Node
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                9
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-8">
               <span class="crayon-r">
                def
               </span>
               <span class="crayon-e">
                rev
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                link
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                link
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-10">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                link
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                None
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tmp
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                pre
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-15">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                pre
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                cur
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-16">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                cur
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                tmp
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-17">
               <span class="crayon-e">
               </span>
               <span class="crayon-st">
                return
               </span>
               <span class="crayon-e">
                pre
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-18">
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-19">
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-e">
                rev
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                link
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-20">
               <span class="crayon-st">
                while
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                :
               </span>
              </div>
              <div class="crayon-line" id="crayon-575513db9de17592013321-21">
               <span class="crayon-h">
               </span>
               <span class="crayon-k ">
                print
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                data
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-575513db9de17592013321-22">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                root
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-k ">
                next
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24678.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/20140917125452915416-216x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24678.html" rel="bookmark" title="python3中的正则模块">
         python3中的正则模块
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24675.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/t015b337bd75d9ef893-161x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24675.html" rel="bookmark" title="注释是恶魔，请不要再写一行注释">
         注释是恶魔，请不要再写一行注释
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24660.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/u16130037972892789947fm21gp0-300x157.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/24660.html" rel="bookmark" title="如何从Github上轻松安装R包">
         如何从Github上轻松安装R包
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/24654.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/06/df53fac99fc53ba5a90666abcca25e6d_b-267x200.png"/>
        </a>
        <a class="link" href="http://dataunion.org/24654.html" rel="bookmark" title="简单形象又有趣地说说强大的神经网络">
         简单形象又有趣地说说强大的神经网络
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F24462.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/24462.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/24462.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>